# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=emacs-xr
pkgver=1.25
_gitrev=b3310b138e7f8a9fe315dd435739f83935c5769d
pkgrel=0
_pkgreal=xr
pkgdesc="Convert string regexp to rx form"
url="https://github.com/mattiase/xr"
arch="noarch"
license="GPL-3.0-or-later"
depends="cmd:emacs"
makedepends="emacs-nox"
source="https://github.com/mattiase/xr/archive/$_gitrev/emacs-xr-$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$_gitrev"

build() {
	emacs -batch -q -no-site-file -L . \
		-eval '(setq byte-compile-error-on-warn t)' \
		-f batch-byte-compile \
		./*.el
}

check() {
	emacs -batch -q -no-site-file -L . \
		-l xr-test -f ert-run-tests-batch-and-exit
}

package() {
	install -Dvm644 xr.el xr.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/

	cd "$pkgdir"/usr/share/emacs/site-lisp
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
ef9d365bf26934fef290068178adbe7ac58b3cdf5cfbebe91c6ccf4f0a927bfd089c2408f962468e42c7a79548afdc91b17e9ad144bd4ccd41575c1e47ae0a96  emacs-xr-1.25.tar.gz
"
